import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
import get from '@dfeidao/atom-mobile/local/get';
import set from '@dfeidao/atom-mobile/local/set';
import nodejs from '@dfeidao/atom-mobile/msg/nodejs';
// import get_param from '@dfeidao/atom-mobile/nav/get-param';
import render from '@dfeidao/atom-mobile/render/render';
import whoami from '../atom/whoami_getparams';



export default async function a001(fd: IFeidaoAiMobile) {
	// 初始化
	// 获取系统参数,未登录，获取不到session报错
	const user = await whoami(fd) as {
		params: {
			teacher_name: string;
			productid: string;
			teacher_no: string;
		}
	};
	set(fd, 'productid', user.params.productid);
	const productid = get(fd, 'productid');
	// await set(fd, 'user_who', user);
	const teacher_no = user.params.teacher_no;
	// const teacher_no = get_param(fd, 'teacher_no');
	// const teacher_no = 'JS0004';
	set(fd, 'teacher_no', teacher_no);

	const d = await nodejs<{ headimg: string, teacher_name: string }>('app-personal-center/s001', {
		filter: {
			teacher_no// todo ps.params.teacher_no
		},
		page_no: 1,
		productid
	});
	await set(fd, 'data', d);
	set(fd, 'teacher_name', d.teacher_name);

	render(fd, { d });

}
